home *** CD-ROM | disk | FTP | other *** search
/ FM Towns: Free Software Collection 7 / FM Towns Free Software Collection 7.iso / taropyon / hewin / ccisrc / main.cci < prev    next >
Text File  |  1993-11-30  |  9KB  |  244 lines

  1. /*************************************************************************
  2. *    "hewin.cci"
  3. *************************************************************************/
  4.  
  5. #define    _GENERIC_SYSTEM                /* 一般公開用            */
  6.  
  7. /* #define    _TERM_IGNORE */            /* 通信機能は使わない    */
  8.  
  9. #include    "ccicfg.h"
  10. #include    "defs.h"
  11. #include    "apl.h"
  12. #include    "lib.h"
  13. #include    "fdl.h"
  14. #include    "color.h"
  15. #include    "keycode.h"
  16. #include    "moscur.h"
  17. #include    "aplno.h"
  18. #include    "aplcol.h"
  19. #include    "txdofs.h"
  20. #include    "txdcmd.h"
  21. #include    "tdpcmd.h"
  22. #include    "affcopy.h"
  23. #include    "affrun.h"
  24. #include    "dcncmd.h"
  25. #include    "dcncci.h"
  26. #ifndef        _NTM_IGN
  27. #    include    "ntmcmd.h"
  28. #    include    "ntmcci.h"
  29. #endif
  30.  
  31. char    *SysMacro = NULL;    /* システムマクロ    */
  32. #ifndef    __HEWN__
  33. char    SYSMACRO_FN[10] = {'h','e','w','i','n','.','m','a','c','\0'};
  34. #else
  35. char    SYSMACRO_FN[10] = {'h','e','w','m','.','m','a','c','\0'};
  36. #endif
  37.  
  38. #include    "lib.cci"
  39. #include    "colset.cci"
  40. #include    "bgm.cci"
  41. #include    "blackout.cci"
  42. #include    "timer.cci"
  43. #include    "debug.cci"
  44. #include    "wpaper.cci"
  45. #include    "expcfg.cci"
  46.  
  47. #ifndef    _CCI_APL_IGN
  48. #include    "cciapl.cci"
  49. #endif
  50.  
  51. /*************************************************************************
  52. *    システム初期化
  53. *************************************************************************/
  54.  
  55. #define    WILDCARD_TBL_NUM    11
  56. char    *WildCardTbl[WILDCARD_TBL_NUM] = 
  57. {
  58.     "*.*"  ,
  59.     "*.asm",
  60.     "*.bgm",
  61.     "*.c"  ,
  62.     "*.cci",
  63.     "*.doc",
  64.     "*.eup",
  65.     "*.h"  ,
  66.     "*.mid",
  67.     "*.mml",
  68.     "*.txt"
  69. };
  70.  
  71. /*************************************************************************
  72. *    ファイルマネージャの環境設定
  73. *************************************************************************/
  74.  
  75. int        AfmSetup()
  76. {
  77.     int        i;
  78.     char    comspec[128], *s;
  79.     char    *console;
  80.  
  81.     if ( (s = getenv("COMSPEC")) == NULL )
  82.         strcpy( comspec, "C:\\COMMAND.COM /C" );
  83.     else
  84.         sprintf( comspec,"%s /C", s );
  85.     console = "oricon";
  86.  
  87.     Afm_setRunFile(0,".exe"       , AFFRUN_TYP_DOS, AFFRUN_DOS_MD_NORMAL, "","");
  88.     Afm_setRunFile(0,".com"       , AFFRUN_TYP_DOS, AFFRUN_DOS_MD_NORMAL, "","");
  89.     Afm_setRunFile(0,".bat"       , AFFRUN_TYP_DOS, AFFRUN_DOS_MD_NORMAL, "","");
  90.  
  91.     Afm_setRunFile(0,"miel.com"   , AFFRUN_TYP_DOS, AFFRUN_DOS_MD_NORMAL, console, comspec);
  92.     Afm_setRunFile(0,"mipp.exe"   , AFFRUN_TYP_DOS, AFFRUN_DOS_MD_NORMAL, console, comspec);
  93.     Afm_setRunFile(0,"setup.exe"  , AFFRUN_TYP_DOS, AFFRUN_DOS_MD_NORMAL, console, comspec);
  94.  
  95.     Afm_setRunFile(0,"makefile"   , AFFRUN_TYP_DOS, AFFRUN_DOS_MD_NORMAL, "make" ,"");
  96.     Afm_setRunFile(0,".lzh"       , AFFRUN_TYP_DOS, AFFRUN_DOS_MD_NORMAL, "LHa"  ,"l");
  97.     Afm_setRunFile(0,".ish"       , AFFRUN_TYP_DOS, AFFRUN_DOS_MD_NORMAL, "ish"  ,"% /r");
  98.  
  99. #ifdef    _TAROPYON_SYSTEM
  100.     Afm_setRunFile(0,".doc"       , AFFRUN_TYP_IAP, APL_TYPE_TDP, "-rightMargin  80                -tab 2 -tabSpace ON -dspCUL ON -dspKS ON -colTbl editcol.tbl");
  101.     Afm_setRunFile(0,".txt"       , AFFRUN_TYP_IAP, APL_TYPE_TDP, "-rightMargin  80                -tab 2 -tabSpace ON -dspCUL ON -dspKS ON -colTbl editcol.tbl");
  102.     Afm_setRunFile(0,".nif"       , AFFRUN_TYP_IAP, APL_TYPE_TDP, "-rightMargin  80                -tab 8              -dspCUL ON -dspKS ON -colTbl editcol.tbl");
  103.     Afm_setRunFile(0,".c"         , AFFRUN_TYP_IAP, APL_TYPE_TDP, "-rightMargin 256 -autoIndent ON -tab 4              -dspCUL ON -dspKS ON -colTbl editcol.tbl");
  104.     Afm_setRunFile(0,".cci"       , AFFRUN_TYP_IAP, APL_TYPE_TDP, "-rightMargin 256 -autoIndent ON -tab 4              -dspCUL ON -dspKS ON -colTbl editcol.tbl");
  105.     Afm_setRunFile(0,".h"         , AFFRUN_TYP_IAP, APL_TYPE_TDP, "-rightMargin 256 -autoIndent ON -tab 4              -dspCUL ON -dspKS ON -colTbl editcol.tbl");
  106.     Afm_setRunFile(0,".asm"       , AFFRUN_TYP_IAP, APL_TYPE_TDP, "-rightMargin 256 -autoIndent ON -tab 8              -dspCUL ON -dspKS ON -colTbl editcol.tbl");
  107. #else
  108.     Afm_setRunFile(0,".doc"       , AFFRUN_TYP_IAP, APL_TYPE_TDP, "-rightMargin  80 -tab 2 -tabSpace ON -dspKS ON");
  109.     Afm_setRunFile(0,".txt"       , AFFRUN_TYP_IAP, APL_TYPE_TDP, "-rightMargin  80 -tab 2 -tabSpace ON -dspKS ON");
  110.     Afm_setRunFile(0,".c"         , AFFRUN_TYP_IAP, APL_TYPE_TDP, "-rightMargin 256 -autoIndent ON -tab 4 -dspKS ON");
  111.     Afm_setRunFile(0,".cci"       , AFFRUN_TYP_IAP, APL_TYPE_TDP, "-rightMargin 256 -autoIndent ON -tab 4 -dspKS ON");
  112.     Afm_setRunFile(0,".h"         , AFFRUN_TYP_IAP, APL_TYPE_TDP, "-rightMargin 256 -autoIndent ON -tab 4 -dspKS ON");
  113.     Afm_setRunFile(0,".asm"       , AFFRUN_TYP_IAP, APL_TYPE_TDP, "-rightMargin 256 -autoIndent ON -tab 8 -dspKS ON");
  114. #endif
  115.  
  116.     Afm_setRunFile(0,".tbi"       , AFFRUN_TYP_IAP, APL_TYPE_TBI , "");
  117.  
  118.     Afm_setRunFile(0,".tif"       , AFFRUN_TYP_IAP, APL_TYPE_IDP , "");
  119.  
  120.     Afm_setRunFile(0,".snd"       , AFFRUN_TYP_CCI, "CCI_sndPlay", "");
  121.     Afm_setRunFile(0,".bgm"       , AFFRUN_TYP_CCI, "CCI_bgmPlay" , "");
  122.     Afm_setRunFile(0,".eup"       , AFFRUN_TYP_CCI, "CCI_midPlay" , "");
  123.     Afm_setRunFile(0,".mid"       , AFFRUN_TYP_CCI, "CCI_midPlay" , "");
  124.  
  125.     Afm_setRunFile(0,".kbl"       , AFFRUN_TYP_CCI, "CCI_loadKbl", "");
  126.     Afm_setRunFile(0,".rpl"       , AFFRUN_TYP_CCI, "CCI_loadRpl", "");
  127.  
  128. #ifdef    _TAROPYON_SYSTEM
  129.     /* ネイティブモード子プロセスプログラムの格納パス    */
  130.     AplPclSetPath( "I:/HC/GUILIB3/PRG/CCI"    );    /* CCI        */
  131.     AplPclSetPath( "I:/HC/GUILIB3/PRG/GSPLAY" );    /* GSPLAY    */
  132.     AplPclSetPath( "I:/HC/GUILIB3/PRG/LHX"    );    /* LHx        */
  133.     AplPclSetPath( "I:/HC/GUILIB3/PRG/MML"    );    /* HE386    */
  134.     AplPclSetPath( "I:/HC/GUILIB3/PRG/ZMODEM" );    /* SZ/RZ    */
  135. #endif
  136.  
  137.     /* デフォルトワイルドカードの設定    */
  138.     for ( i = 0 ; i < WILDCARD_TBL_NUM; ++i )
  139.         FdlSetWildCardList( WildCardTbl[i] );
  140. }
  141.  
  142. /*************************************************************************
  143. *    HEwin 起動時の初期化
  144. *-------------------------------------------------------------------------
  145. *    int        HEWIN_start(int argc, char **argv)
  146. *        argc, argv には未定義の起動時オプションが渡される
  147. *************************************************************************/
  148.  
  149. int        HEWIN_start(int argc, char **argv)
  150. {
  151.     int        i, kan, kan_md;
  152.     char    tmp[256], *s;
  153.  
  154.     if ( (SysMacro = AMAC_allocWork(0)) != NULL )
  155.     {
  156.         sprintf( tmp, "%s%s", AplGetStartPath(), SYSMACRO_FN );
  157.         AMAC_load( SysMacro, tmp );
  158.         GetAsciiTime( tmp, time(NULL) );
  159.         AMAC_setKey( SysMacro, "Startup_time", tmp );
  160.     }
  161.     AfmSetup();
  162. #ifndef    _CCI_APL_IGN
  163.     CCI_aplSysInit();
  164. #endif
  165.  
  166.     for ( i = 0; i < argc ; ++i )
  167.     {
  168.         s = argv[i];
  169.         if ( strcmpi( s, "-fep_roumaji") == 0 )
  170.         {    /* デフォルト入力モード[ローマ字]    */
  171.             kan = KBF_kan_getMode();    /* 現在のかな漢動作状態        */
  172.             if ( kan < 0 )                /* FEP OFF状態                */
  173.             {                            /* FEP ON にしてモード取得    */
  174.                 KBF_kan_on();
  175.                 kan_md = KBF_kan_getMode();
  176.             } else
  177.                 kan_md = kan;            /* 現在のモード                */
  178.             if ( kan_md >= 0 )
  179.             {
  180.                 kan_md = (kan_md & 0xFFFFFF0F) | KAN_ROUMAZI;
  181.                 KBF_kan_setMode( kan_md );    /* モード設定            */
  182.                 if ( kan < 0 )            /* かな漢動作状態を元に戻す    */
  183.                     KBF_kan_off();
  184.             }
  185.         }
  186.     }
  187.     return (NORMAL);
  188. }
  189.  
  190. /*************************************************************************
  191. *    HEwin 終了時の処理
  192. *************************************************************************/
  193.  
  194. int        HEWIN_term(int saveFlag)
  195. {
  196.     char    tmp[256];
  197.  
  198. #ifndef    _CCI_APL_IGN
  199.     CCI_aplSysTerm(saveFlag);
  200. #endif
  201.     if ( SysMacro )
  202.     {
  203.         GetAsciiTime( tmp, time(NULL) );
  204.         AMAC_setKey( SysMacro, "Exit_time", tmp );
  205.  
  206.         sprintf( tmp, "%s%s", AplGetStartPath(), SYSMACRO_FN );
  207.         AMAC_save( SysMacro, tmp, "System macro" );
  208.     }
  209.     return (0);
  210. }
  211.  
  212. /*************************************************************************
  213. *    アプリケーションセレクタ、デフォルトアイテム登録
  214. *-------------------------------------------------------------------------
  215. *    "hewin.itm" が存在しない場合に、この関数が実行される
  216. *************************************************************************/
  217.  
  218. int        AslUsr_setStartItem()
  219. {
  220.     /*                 関数名               タイトル     パラメータ    */
  221.     Asl_setDefCciItem("CCI_textViewer"     ,"☆読んでネ","message.doc");
  222.     Asl_setDefCciItem("CCI_textViewer"     ,"説明"      ,"hewin.doc");
  223.     Asl_setDefCciItem("CCI_setWallPaper"   ,"壁紙"      ,"");
  224.     Asl_setDefCciItem("CCI_sidework"       ,"SideWork"  ,"");
  225.     Asl_setDefCciItem("CCI_sndPlay"        ,"SND-PLAY"  ,"");
  226.     Asl_setDefCciItem("CCI_expSetup"       ,"EXP SETUP" ,"");
  227. /*    Asl_setDefCciItem("CCI_hewin_install"  ,"Install"   ,"");    */
  228. #ifdef    _CCISRC_EXTRACT
  229.     Asl_setDefCciItem("CCI_extractHewinCci","CCI解凍"   ,"");
  230. #endif
  231.  
  232.     return (NORMAL);
  233. }
  234.  
  235. #include    "he386.cci"
  236. #include    "prs.cci"
  237. #include    "tdp.cci"
  238. #include    "dcn.cci"
  239. #ifndef        _NTM_IGN
  240. #    include    "ntm.cci"
  241. #endif
  242. #include    "tools.cci"
  243. #include    "sndplay.cci"
  244.